<script>
	import { mapMutations } from 'vuex'
	
	export default {
		methods:{
			...mapMutations(['login'])
		},
		globalData:{
			faceResult:"",				//人脸识别结果
		},
		onLaunch: function(option) {
			let userInfo = uni.getStorageSync('userInfo') || ""
			//自动化登录
			if(userInfo.token){
				this.login(userInfo)
			}
			
			let that=this
			uni.$u.api.getConfig().then(res => {
				//设置主题色
				if(res.data.theme==undefined){
					res.data.theme={
						view_color:"--view-theme:#00cf97;--view-assist:#2a89ff;--view-themeLight:#7BE0C5;--view-fontcolor:#fff;",
						theme: "#00cf97",
						themeLight:"#7BE0C5",
						assist: "#2a89ff",
						fontcolor: "#FFF",
					}
				}
				this.$store.commit('setConfig',res.data)
				that.$isResolve();
			});
			
			
			// 绑定分销关系
			let agent_id=this.$c.getScene(option)
			if(agent_id){
				this.$store.commit('setAgentID',agent_id)
			}
			
			// #ifndef H5
			//加载分享连接
			this.$c.getShare(1)
			// #endif

		},
		onShow: function(option) {
			
			// 接受人脸识别小程序传过来的数据
			let referrerInfo=option.referrerInfo || {}
			if(referrerInfo.extraData!=undefined && referrerInfo.appId==="wxe83fe5a4f77efb58"){
				this.globalData.faceResult=referrerInfo.extraData
			}
		},
		onHide: function() {
			
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-ui/index.scss";
</style>